<form action="php/p_add.php" method="post" data-ajax="false">
    <h2>Projektnr.:
    <?php
        mysql_query("SET NAMES 'utf8'");
        mysql_query("SET CHARACTER SET 'utf8'");

        $sql = "SELECT * FROM project WHERE year = '" . date('Y') . "' AND month = '" . date('m') . "' ORDER BY ym_p_nr DESC LIMIT 1";
        $result = mysql_query($sql);

        if (mysql_num_rows($result) > 0) {
            $data = mysql_fetch_array($result);
            $project_nr_single = $data['ym_p_nr'] + 1;
            if ($project_nr_single < 10) {
                $project_nr_single = "0" . $project_nr_single;
            }
            $project_nr = date('Y-m'). '-' . $project_nr_single;
            echo 'A ' . $project_nr;
        } else {
            $project_nr = date('Y-m'). '-01';
            echo 'A ' . $project_nr;
        }
    ?>
    </h2>
    <label for="projektname" class="ui-hidden-accessible">Projektname:</label>
    <input type="text" name="p_name" id="p_name" placeholder="Projektname" />
    <h3>Anschrift</h3>
    <input type="text" name="p_street" id="p_street" placeholder="Stra&szlig;e" />
    <input type="tel" name="p_zip" id="p_zip" placeholder="Postleitzahl" />
    <input type="text" name="p_city" id="p_city" placeholder="Ort *" />
    <h3>Datum der Anfrage</h3>
    <input type="date" id="p_date" name="p_date" />
    <h3>Auftraggeber</h3>
    <label for="p_client" class="select ui-hidden-accessible">Auftraggeber:</label>
    <div id="p_client">
        <select name="p_client_list" id="p_client_list"  data-native-menu="false">
            <option value="new">Neuen Auftraggeber</option>
        <?php
            $sql = "SELECT *FROM client";
            $result = mysql_query($sql);

            if (mysql_num_rows($result) > 0) {
                while ($data = mysql_fetch_array($result)) {
        ?>
                    <option value="<?php echo $data['client_id'] ?>"><?php echo $data['name'] ?></option>
        <?php
                }
            } else {
        ?>
                <option value="no">Keine Auftraggeber</option>
        <?php
            }
        ?>
        </select>
    </div>
    <div id="new_client">
        <ul class="ui-listview ui-listview-inset ui-corner-all ui-shadow" data-inset="true" data-role="listview">
            <li class="ui-li ui-li-static ui-body-c ui-corner-top">
                <table align="center">
                    <tr>
                        <td style="vertical-align: middle">
                            <img src="../assets/images/alert.png" width="34px" />
                        </td>
                        <td width="20px"></td>
                        <td style="vertical-align: middle">
                            Folgende Felder m&uuml;ssen nur ausgef&uuml;llt werden, wenn <font style="color:green">
                            "Neuen Auftraggeber"</font> ausgew&auml;hlt ist, ansonsten werden diese Felder ignoriert!
                        </td>
                    </tr>
                </table>
            </li>
        </ul>
        <h4>Neuer Auftraggeber:</h4>
        <input type="text" name="client_name" id="client_name" placeholder="Auftraggeber *" />
        <input type="text" name="client_street" id="client_street" placeholder="Stra&szlig;e *" />
        <input type="tel" name="client_zip" id="client_zip" placeholder="Postleitzahl *" />
        <input type="text" name="client_city" id="client_city" placeholder="Ort *" />
    </div>
    <br />
    <button type="submit" data-theme="e">Projekt hinzuf&uuml;gen</button>
</form>
